/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */


#include "hctest.h"
#include <unistd.h>
#include <zephyr/kernel.h> 
// #include "hks_derive_test.h"

// #include "hks_api.h"
// #include "hks_param.h"
// #include "hks_test_api_performance.h"
// #include "hks_test_common.h"
// #include "hks_test_log.h"
#include <zephyr/portability/cmsis_os2.h>
#include "ohos_types.h"

#define DEFAULT_DERIVE_SIZE 32
#define DEFAULT_INFO_SIZE 55
#define DEFAULT_SALT_SIZE 16
#define TEST_TASK_STACK_SIZE      0x200
#define WAIT_TO_TEST_DONE         4
static K_THREAD_STACK_DEFINE(test_stack, TEST_TASK_STACK_SIZE);
static osPriority_t g_setPriority;

/*
 * @tc.register: register a test suit named "CalcMultiTest"
 * @param: test subsystem name
 * @param: c_example module name
 * @param: CalcMultiTest test suit name
 */
LITE_TEST_SUIT(security, securityData, HksDeriveTest);
static int32_t HksInitialize(void)
{
    return 0;
}

static void ExecHksInitialize(void const *argument)
{
    LiteTestPrint("HksInitialize Begin!\n");
    TEST_ASSERT_TRUE(HksInitialize() == 0);
    LiteTestPrint("HksInitialize End!\n");
}
/**
 * @tc.setup: define a setup for test suit, format:"CalcMultiTest + SetUp"
 * @return: true——setup success
 */
static BOOL HksDeriveTestSetUp()
{
    LiteTestPrint("setup\n");
    // osThreadId_t id;
    // osThreadAttr_t attr;
    // g_setPriority = osPriorityAboveNormal6;
    // attr.name = "test";
    // attr.attr_bits = 0U;
    // attr.cb_mem = NULL;
    // attr.cb_size = 0U;
    // attr.stack_mem = &test_stack;
    // attr.stack_size = TEST_TASK_STACK_SIZE;
    // attr.priority = g_setPriority;
    // id = osThreadNew((osThreadFunc_t)ExecHksInitialize, NULL, &attr);
    ExecHksInitialize(NULL);
    k_sleep(K_SECONDS(WAIT_TO_TEST_DONE));
    // osThreadDetach(id);
    LiteTestPrint("HksDeriveTestSetUp End2!\n");
    return TRUE;
}

/**
 * @tc.teardown: define a setup for test suit, format:"CalcMultiTest + TearDown"
 * @return: true——teardown success
 */
static BOOL HksDeriveTestTearDown()
{
    LiteTestPrint("tearDown\n");
    return TRUE;
}


static int32_t BaseTestDerive(uint32_t index)
{
    /* 1. generate key */
    int32_t ret = 0;
    

    return ret;
}

static void ExecHksDeriveTest001(void const *argument)
{
    LiteTestPrint("HksDeriveTest001 Begin!\n");
    int32_t ret = BaseTestDerive(0);
    TEST_ASSERT_TRUE(ret == 0);
    LiteTestPrint("HksDeriveTest001 End!\n");
}

static void ExecHksDeriveTest002(void const *argument)
{
    LiteTestPrint("HksDeriveTest002 Begin!\n");
    int32_t ret = BaseTestDerive(1);
    TEST_ASSERT_TRUE(ret == 0);
    LiteTestPrint("HksDeriveTest002 End!\n");
}

static void ExecHksDeriveTest003(void const *argument)
{
    LiteTestPrint("HksDeriveTest003 Begin!\n");
    int32_t ret = BaseTestDerive(2);
    TEST_ASSERT_TRUE(ret == 0);
    LiteTestPrint("HksDeriveTest003 End!\n");
}

#ifndef _CUT_AUTHENTICATE_
/**
 * @tc.name: HksDeriveTest.HksDeriveTest001
 * @tc.desc: The static function will return true;
 * @tc.type: FUNC
 */
LITE_TEST_CASE(HksDeriveTest, HksDeriveTest001, Level1)
{
    // osThreadId_t id;
    // osThreadAttr_t attr;
    // g_setPriority = osPriorityAboveNormal6;
    // attr.name = "test";
    // attr.attr_bits = 0U;
    // attr.cb_mem = NULL;
    // attr.cb_size = 0U;
    // attr.stack_mem = &test_stack;
    // attr.stack_size = TEST_TASK_STACK_SIZE;
    // attr.priority = g_setPriority;
    // id = osThreadNew((osThreadFunc_t)ExecHksDeriveTest001, NULL, &attr);
    ExecHksDeriveTest001(NULL);
    k_sleep(K_SECONDS(WAIT_TO_TEST_DONE));
    // osThreadDetach(id);
    LiteTestPrint("HksDeriveTest001 End2!\n");
}
/**
 * @tc.name: HksDeriveTest.HksDeriveTest003
 * @tc.desc: The static function will return true;
 * @tc.type: FUNC
 */
LITE_TEST_CASE(HksDeriveTest, HksDeriveTest003, Level1)
{
    // osThreadId_t id;
    // osThreadAttr_t attr;
    // g_setPriority = osPriorityAboveNormal6;
    // attr.name = "test";
    // attr.attr_bits = 0U;
    // attr.cb_mem = NULL;
    // attr.cb_size = 0U;
    // attr.stack_mem = &test_stack;
    // attr.stack_size = TEST_TASK_STACK_SIZE;
    // attr.priority = g_setPriority;
    // id = osThreadNew((osThreadFunc_t)ExecHksDeriveTest003, NULL, &attr);
    ExecHksDeriveTest003(NULL);
    k_sleep(K_SECONDS(WAIT_TO_TEST_DONE));
    // osThreadDetach(id);
    LiteTestPrint("HksDeriveTest001 End2!\n");
}
#endif /* _CUT_AUTHENTICATE_ */

/**
 * @tc.name: HksDeriveTest.HksDeriveTest002
 * @tc.desc: The static function will return true;
 * @tc.type: FUNC
 */
LITE_TEST_CASE(HksDeriveTest, HksDeriveTest002, Level1)
{
    // osThreadId_t id;
    // osThreadAttr_t attr;
    // g_setPriority = osPriorityAboveNormal6;
    // attr.name = "test";
    // attr.attr_bits = 0U;
    // attr.cb_mem = NULL;
    // attr.cb_size = 0U;
    // attr.stack_mem = &test_stack;
    // attr.stack_size = TEST_TASK_STACK_SIZE;
    // attr.priority = g_setPriority;
    // id = osThreadNew((osThreadFunc_t)ExecHksDeriveTest002, NULL, &attr);
    ExecHksDeriveTest002(NULL);
    k_sleep(K_SECONDS(WAIT_TO_TEST_DONE));
    // osThreadDetach(id);
    LiteTestPrint("HksDeriveTest002 End2!\n");
}

RUN_TEST_SUITE(HksDeriveTest);
